<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<input type="text" />
		<input type="button" id="ok" value="确定"/>
		<script src="../External%20js/jquery.min.js"></script>
		<script>
			$(() => {
				const url = 'http://api.tianapi.com/txapi/dream/index'
				let word = ''			
				$('#ok').on('click',() => {
					let input = $('#ok+input')
					let word = input.val()
					let data = {"key":"1032f66a7a384b95ee84b304bbe9f4d6",
								"num":10,"word":word
					}
					
					$.ajax({
						"url":url,
						"type":"get",
						"data":data,
						"dataType":"json",
						"success":((json) => {
							json.newslist.forEach((foo) => {
								$('#ok').append($('<p>').text(foo.result)
								)
							})
						})
					})
				})
			})
		</script>
	</body>
</html>
